package lesson5;

public class Demo2 {
    public static void main(String[] args) {
        MyClass myClass1 = MyClass.getInstance();
        MyClass myClass2 = MyClass.getInstance();
        MyClass myClass3 = MyClass.getInstance();
        //MyClass.clearInstance();
        myClass3 = null;
        MyClass myClass4 = MyClass.getInstance();
        MyClass myClass5 = MyClass.getInstance();
        System.out.println(myClass1 == myClass2);
        System.out.println(myClass1 == myClass4);
        System.out.println(myClass1 == MyClass.getInstance());
//        MyClass myClass1 = MyClass.getInstance();
//        MyClass.clearInstance();
//        MyClass myClass2 = MyClass.getInstance();
//        MyClass.clearInstance();
//        MyClass myClass3 = MyClass.getInstance();

//        System.out.println(myClass1 == MyClass.getInstance());
//        System.out.println(myClass2 == MyClass.getInstance());
//        System.out.println(myClass3 == MyClass.getInstance());
        //1 true false
        //2 ?
        //
        //4 true true
        //5 true true
        //6 true
        //7 true false
        //8 true true
        //9 true false
        //10 true false
        //11 true
        //12 true
        //13 true
        //14 true
        //15 true
        //16 true
        //17 true
        //18 true false

    }
}
